#!/bin/sh

wget http://libregamenight.xyz/pub/hedgewars/data.deb
sudo dpkg -i data.deb

if [ $(arch) = "x86_64" ]
    then
        wget http://libregamenight.xyz/pub/data/hedgewars/amd64.deb
        sudo dpkg -i amd64.deb
        if [ $? -eq 1 ]
        then
            sudo apt-get install -f
            sudo dpkg -i amd64.deb
        fi
    else
        wget http://libregamenight.xyz/pub/data/hedgewars/i386.deb
        sudo dpkg -i i386.deb
        if [ $? -eq 1 ]
        then
            sudo apt-get install -f
            sudo dpkg -i i386.deb
        fi
fi

echo "Time to reap the profits, now!"
echo "Hedgewars 0.9.22 is now installed-- it should be in your Games menu."
echo "Cheers!"
echo "Note-- if you experienced any errors, run 'sudo apt-get install -f'"
echo "Then run 'sudo dpkg -i i386.deb' or 'sudo dpkg -i amd64.deb'"
